import { observable,computed, action, asMap, toJS } from 'mobx';
import * as API from '../../api/fnaSpecial'
import { ListViewPage  } from 'weaver-mobile-page';

export default class PopupBillNumberStore {
  @observable longList = new ListViewPage.Store();
  @observable loding = false;

  //暂时没用到
  template = {
      default: {
          theme: 'col2_row2',
          dataKeys: ['user', 'decription', 'amount', 'time']
      }
    };
  
  //暂时没用到
  template2 = {
          default: '<div style="padding: 0 12px"><div style="color: #333; font-size: 16px">#{user}</div>' +
          '<div style="color: #f00; font-size: 14px">#{amount}</div>' +
          '<div style="color: #333; font-size: 14px">#{time}</div>' +
          '<div style="color: #333; font-size: 14px">#{decription}</div></div>',
  };

  //借款流程的单内序号
  @action
  queryDtlRowData_borrow = (params) => {
    this.loding = true;
    params = {dataType:0, ...params};
    API.queryDtlRowData_borrow(params).then( result => {
        const { datas: dataKey } = result;
        if (dataKey) {
          this.dataKey = dataKey;
        }
        this.longList = new ListViewPage.Store();//不然不会刷新
        this.longList.getData( {dataKey});
        this.loding = false;
    })
  }

  //预付款流程的单内序号
  @action
  queryDtlRowData_advance = (params) => {
    this.loding = true;
    params = {dataType:0, ...params};
    API.queryDtlRowData_advance(params).then( result => {
        const { datas: dataKey } = result;
        if (dataKey) {
          this.dataKey = dataKey;
        }
        this.longList = new ListViewPage.Store();//不然不会刷新
        this.longList.getData( {dataKey});
        this.loding = false;
    })
  }
  
}